package model

import "gorm.io/gorm"

type MenuFillAble struct {
	Pid       uint   `json:"pid" gorm:"comment:父级ID"`
	Name      string `json:"name" gorm:"comment:名称"`
	Type      int    `json:"type" gorm:"comment:类型：0节点，1路由菜单"`
	Icon      string `json:"icon" gorm:"comment:图标"`
	Link      string `json:"link" gorm:"comment:链接"`
	Sort      int    `json:"sort" gorm:"comment:排序号"`
	CreatedBy uint   `json:"created_by" gorm:"comment:创建人"`
	UpdatedBy uint   `json:"updated_by" gorm:"comment:创建人"`
}

type Menu struct {
	gorm.Model
	//Roles []Role `json:"roles" gorm:"many2many:role_menus;"`
	MenuFillAble
	//DisableCheckbox bool `json:"disableCheckbox" gorm:"-"`
	//Disabled         bool `json:"disabled" gorm:"-"`
}

func (AssignMenu) TableName() string {
	return "menus"
}

type AssignMenu struct {
	gorm.Model
	//Roles []Role `json:"roles" gorm:"many2many:role_menus;"`
	MenuFillAble
}

type MenuTree struct {
	AssignMenu
	Children []MenuTree `json:"children" gorm:"-"`
}

type AntMenuTree struct {
	ID       uint          `json:"id" gorm:"comment:自增ID"`
	Pid      uint          `json:"pid" gorm:"comment:父级ID"`
	Text     string        `json:"text" gorm:"comment:名称"`
	Type     int           `json:"type" gorm:"comment:类型：0节点，1路由菜单"`
	Icon     string        `json:"icon" gorm:"comment:图标"`
	Link     string        `json:"link" gorm:"comment:链接"`
	Sort     int           `json:"sort" gorm:"comment:排序号"`
	Children []AntMenuTree `json:"children" gorm:"-"`
}
